//
//  LYFVistorTableViewController.swift
//  weibohhhh
//
//  Created by fersh on 16/1/4.
//  Copyright © 2016年 fersh. All rights reserved.
//

import UIKit

class LYFVistorTableViewController: UITableViewController {
    
    var userVistor: Bool = false
    lazy var vistorView: LYFVistorView = LYFVistorView()
    
    override func loadView() {
        //根据用户是否登录给视图做不同的逻辑
        userVistor == true ? super.loadView() :setupBasicUI()
    }
    
    private func setupBasicUI() {
        
        //为navigationItem 左右item 添加点击事件
        navigationItem.leftBarButtonItem = UIBarButtonItem(titel: "注册", target: self, action: "registerButtonClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(titel: "登录", target: self, action: "loginButtonClick")
        //视图中的注册和登录按钮添加点击事件
        vistorView.registerButton.addTarget(self, action: "registerButtonClick", forControlEvents: UIControlEvents.TouchUpInside)
        vistorView.loginButton.addTarget(self, action: "loginButtonClick", forControlEvents: UIControlEvents.TouchUpInside)
        view = vistorView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    /**
      注册的点击方法
     */
    @objc private func registerButtonClick() {
        print("注册")
    }
    /**
     登录点击方法
     */
    @objc private func loginButtonClick() {
        print("登录")
    }
    
}
